import Vue from "vue";
import App from "./App";

import uniApp from "./utils/uni-app";
// 状态管理器
import store from "./store";
Vue.prototype.$store = store;

// 背景音乐
// #ifndef H5
import {
  AUDIOS
} from "@/config/resources";
const bgAudioManager = uni.getBackgroundAudioManager();
if (!store.state.setting.IS_OPEN_BG_MUSIC) {
  bgAudioManager.pause();
} else {
  bgAudioManager.src = AUDIOS.AUDIO_BG_MUSIC;
  bgAudioManager.onEnded(() => {
    bgAudioManager.src = AUDIOS.AUDIO_BG_MUSIC;
  });
}
// #endif



// 全局API挂载
import Api from "./api";

Vue.prototype.$api = Api;

// 全局过滤器
import filters from "./utils/filters";

Object.keys(filters).forEach(k => Vue.filter(k, filters[k]));

import mixin from "./utils/mixins";

Vue.config.productionTip = false;

App.mpType = "app";

const app = new Vue({
  mixins: [mixin],
  ...App
});
app.$mount();
